﻿function connectSocketServer() {
    var support = "MozWebSocket" in window ? 'MozWebSocket' : ("WebSocket" in window ? 'WebSocket' : null);
    if (support == null) {
        console.log("Web socket not supported");
        return;
    }

    console.log("* Connecting to server ..<br/>");
    ws = new window[support]('ws://localhost');

    ws.onmessage = function (evt) { console.log("# " + evt.data); };

    ws.onopen = function () {
        console.log('* Connection open<br/>');
    };

    ws.onclose = function () {
        console.log('* Connection closed<br/>');
    }
    //setup secure websocket (for later implementation)
}